////////////////////////////////////////////////////////////////////////////////

#ifndef _PHYSICALOBJECT_H_
#define _PHYSICALOBJECT_H_

////////////////////////////////////////////////////////////////////////////////

#ifndef _PHYSICALTYPES_H_
#include "physicaltypes.h"
#endif

#ifndef _SHAPE_H_
#include "shape.h"
#endif

class b2Body;

////////////////////////////////////////////////////////////////////////////////


/** Physical object - base class for all objects in the game.
*   Encapsulates all physical characteristics which describes object's state.
*
*  @author   Anastasia Karpinska
*  @since    Sep 13th, 2009
*  @updated  Sep 14th, 2009
*/
class PhysicalObject
{
////////////////////////////////////////////////////////////////////////////////

public:

////////////////////////////////////////////////////////////////////////////////


    /** Constructor */
    PhysicalObject( float _mass,
                    const PE::Shape* _shape,
                    float _resistanceCoeff );


    /** Destructor */
    ~PhysicalObject();


////////////////////////////////////////////////////////////////////////////////
//// Collisions
////////////////////////////////////////////////////////////////////////////////


    /** Informs this object about collision with other object */
    virtual void Collision( PhysicalObject& _obj ) = 0;


////////////////////////////////////////////////////////////////////////////////


    /** Get object's position */
    const PE::Point& GetPosition() const;


    /** Get object's velocity */
    const PE::Vector& GetVelocity() const;


    /** Get object's mass */
    double GetMass() const;


    /** Get object's resistance coefficient */
    double GetResistanceCoefficient() const;


    /** Get object's shape */
    const PE::Shape& GetShape() const;


////////////////////////////////////////////////////////////////////////////////


    /** Set object's position */
    void SetPosition(PE::Point _position);


    /** Set object's velocity */
    void SetVelocity(PE::Vector _velocity);


    /** Apply impulse to the object */
    void ApplyImpulse(PE::Direction _dir, double _force);


    /** Sets external object */
    void SetExternalObject( b2Body& _externalObject );


    /** Gets external object */
    b2Body& GetExternalObject();
    const b2Body& GetExternalObject() const;


////////////////////////////////////////////////////////////////////////////////

private:

////////////////////////////////////////////////////////////////////////////////


    /** Object's position */
    PE::Point m_Position;


    /** Object's velocity */
    PE::Vector m_Velocity;

    
    /** Object's mass */
    float m_Mass;


    /** Object's movement resistance coefficient */
    float m_ResistanceCoefficient;


    /** Object's shape */
    const PE::Shape* m_Shape;


    /** Physical object in external physical engine */
    b2Body* m_ExternalObject;


    


////////////////////////////////////////////////////////////////////////////////

};

////////////////////////////////////////////////////////////////////////////////

#endif
